/**
 * 
 */
var CommonUtil = {
		'BindProvince': function(){
			var result = CommonService.getAllProvince();
			if(result.IsSuccess == 1){
				$('#ssl_province').html('');
				var html = '';
				for(var index in result.Result){
					var province_en = result.Result[index];
					html += '<option text="' + province_en.province_name + '" value="' + province_en.province_id + '">';
					html += province_en.province_name;
					html += '</option>';
				}
				$('#ssl_province').append(html);
			}
			else{
				alert(result.ErrorMsg);
			}
		},
		'BindCity': function(province_id){
			var result = CommonService.getCityListByProvinceId(province_id);
			if(result.IsSuccess == 1){
				$('#ssl_city').html('');
				var html = '';
				for(var index in result.Result){
					var city_en = result.Result[index];
					html += '<option text="' + city_en.city_name + '" value="' + city_en.city_id + '">';
					html += city_en.city_name;
					html += '</option>';
				}
				$('#ssl_city').append(html);
				$('#ssl_city').trigger('change');
			}
			else{
				alert(result.ErrorMsg);
			}
		},
		'BindDistrict': function(city_id){
			var result = CommonService.getDistrictListByCityId(city_id);
			if(result.IsSuccess == 1){
				$('#ssl_district').html('');
				var html = '';
				for(var index in result.Result){
					var district_en = result.Result[index];
					html += '<option text="' +　district_en.district_name +　'" value="' + district_en.district_id + '">';
					html += district_en.district_name;
					html += '</option>';
				}
				$('#ssl_district').append(html);
			}
			else{
				alert(result.ErrorMsg);
			}
		},
		'InitRegion': function(city_id){
			CommonUtil.BindProvince();
			CommonUtil.BindCity($('#ssl_province').val());
			CommonUtil.BindDistrict($('#ssl_city').val());
			
			$('#ssl_province').bind('change', function(){
				CommonUtil.BindCity($('#ssl_province').val());
			});
			
			$('#ssl_city').bind('change', function(){
				CommonUtil.BindDistrict($('#ssl_city').val());
			});
		},
		
}; 

$(document).ready(function(){
	
});

